package repos

import javax.inject.Inject

import models.{Role, UserRole}
import org.sedis.Pool
import play.api.db.slick.DatabaseConfigProvider
import repos.Tables.{RoleTable, UserRoleTable}
import slick.backend.DatabaseConfig
import slick.driver.JdbcProfile
import slick.lifted.TableQuery

class RoleRepository @Inject()(databaseConfigProvider: DatabaseConfigProvider,
                               cacheApi: Pool) extends BaseRepository[Role, RoleTable](Tables.roles, cacheApi) {
  override val dbConfig: DatabaseConfig[JdbcProfile] = databaseConfigProvider.get[JdbcProfile]
}

class UserRoleRepository @Inject()(databaseConfigProvider: DatabaseConfigProvider,
                                   cacheApi: Pool)
  extends BaseRepository[UserRole, UserRoleTable](TableQuery[UserRoleTable], cacheApi) {
  override val dbConfig: DatabaseConfig[JdbcProfile] = databaseConfigProvider.get[JdbcProfile]
}
